//********************************************************
// BoardState.java 
// Date: 4/24/2012
// Author: Andrew Landphier
//********************************************************
// Class that represents the gui board as a 3 dimensional array of integers.
// Currently is used to check the state of the board: to determine legal moves for
// the knight popup menu, to check if the initial squares have been set,
//. It could also be used to determine the current winner and the player
// who has the knights on the top.
//*******************************************************
// Edit: Jeff
//



package ui.data;

import java.util.ArrayList;
import javax.swing.JPanel;
import driver.Driver;
import ui.Board;
import ui.Tile;
import functionality.Player;
import functionality.Point;

public abstract class BoardState {
	
	public static int numplayers;
	
	protected static int iBoardSize; //size of the board
	private static int MAXknights = 4; //max knights on a single tile
	
	static int[][][] tilestate;
	final static int TILE = 0; //position of tiles type
	final static int KNIGHT = 1; //position of knights quantity
	final static int PLAYER = 2; //position of player number
	final static int MAX = 3;  //position of max last placed knights
	final int datalength = 4; //length of 3 dimension
	
	public static final Integer TWOPLAYERS = 2, THREEPLAYERS = 3, FOURPLAYERS = 4;
	public static final Integer BOARDSIZE_TWO = 7, BOARDSIZE_THREE = 9, BOARDSIZE_FOUR = 10;
	private static ArrayList<Tile> tilesOnBoard=new ArrayList<Tile>();
	private static ArrayList<JPanel> srcPanel=new ArrayList<JPanel>();
	
	public BoardState(int iPlayer){
		numplayers = iPlayer;
		
		if (iPlayer == TWOPLAYERS) {
			iBoardSize = BOARDSIZE_TWO;
		}
		else if (iPlayer == THREEPLAYERS){
			iBoardSize = BOARDSIZE_THREE;
		}
		else if (iPlayer == FOURPLAYERS){
			iBoardSize = BOARDSIZE_FOUR;
		}
		
		tilestate = new int[iBoardSize][iBoardSize][datalength];
		
		// Initialize the board to all zero's
		for (int i = 0; i < iBoardSize; i++ ){
			for (int j = 0; j < iBoardSize; j++){
				for (int k = 0; k < datalength; k++ ){
					tilestate[i][j][k] = 0;
				}
			}
		}
	}
	
	// ****************** Getters **********************************
	
	/**
	 * 
	 * @return
	 * @author Jeff Xiong
	 */
	public ArrayList<Tile> getAllTiles()
	{
		ArrayList<Tile> tilesOnBoard2=new ArrayList<Tile>();
		for(Tile x:tilesOnBoard)
		{
			tilesOnBoard2.add(x);
		}
		return tilesOnBoard2;
	}
	
	
	
	/**
	 * Increments the point in proper direction and returns the point
	 * @param p initial point
	 * @param dir string direction heading 
	 * @return next point in the specified direction
	 * @author Andrew Landphier
	 */
	public static Point directionInc(Point p, String dir) {
		Point pnew = new Point();
		Point itr = getItr(dir);
		pnew.setX(p.getX()+itr.getX());
		pnew.setY(p.getY()+itr.getY());
		return pnew;
	}
	
	/**
	 * Returns the point orientation of the cardinal direction for placing knights on a board
	 * @param dir string North, South, East, West
	 * @return point(int, int)
	 * @author Andrew Landphier
	 */
	public static Point getItr(String dir){
		int dirX=0, dirY=0;
		Point p = new Point();
		if (dir.equalsIgnoreCase("Place Knight "+ Driver.NORTH)){
			dirX = -1;
		} else if (dir.equalsIgnoreCase("Place Knight "+ Driver.SOUTH)){
			dirX = 1;
		} else if (dir.equalsIgnoreCase("Place Knight "+ Driver.WEST)){
			dirY = -1;
		} else if (dir.equalsIgnoreCase("Place Knight "+Driver.EAST)){
			dirY = 1;
		}
		p.setX(dirX);
		p.setY(dirY);
		return p;
	}
	
	/**
	 * Get the tile (int) at the corresponding point
	 * @param p point
	 * @return tile int
	 * @author Andrew Landphier
	 */
	public static int getTile(Point p){
		return tilestate[p.getX()][p.getY()][TILE];
	}
	
	/**
	 * Get the number of knights at the point
	 * @param p point
	 * @return int number of knights
	 * @author Andrew Landphier
	 */
	public static int getKnight(Point p){
		return tilestate[p.getX()][p.getY()][KNIGHT];
	}
	
	/**
	 * knight popup does not update top player
	 * @param p (point)
	 * @return (int) top player, 0 if blank
	 * @author Andrew Landphier
	 */
	public int getPlayer(Point p){
		return tilestate[p.getX()][p.getY()][PLAYER];
	}
	
	/**
	 * Gets the maximum number of knights last placed on the board at that position
	 * @param p point
	 * @return int number of knights
	 */
	public int getMax(Point p){
		return tilestate[p.getX()][p.getY()][MAX];
	}
	
	/**
	 * knight popup does not update top player
	 * Returns a grid of integers which represent the player with the top knight on the tile at the grid location
	 * @return (int[][]) grid of player int types at the location, 0 if blank
	 * @author Andrew Landphier
	 */
	public int[][] getTopPlayers(){
		int[][] topplayers = new int[iBoardSize-1][iBoardSize-1];
		for (int i = 0; i < iBoardSize; i++ ){
			for (int j = 0; j < iBoardSize; j++){
				topplayers[i][j] = tilestate[i][j][PLAYER];
			}
		}
		return topplayers;
	}
	
	/**
	 * Gets all the current tile types in a double sized array resembling the grid
	 * @return (int[][]) grid of int tile types at the location, 0 if blank
	 * @author Andrew Landphier
	 */
	public int[][] getTiles(){
		int[][] tiles = new int[iBoardSize-1][iBoardSize-1];
		for (int i = 0; i < iBoardSize; i++ ){
			for (int j = 0; j < iBoardSize; j++){
				tiles[i][j] = tilestate[i][j][TILE];
			}
		}
		return tiles;
	}
	
	/**
	 * ----------> (NOT USED) <----------
	 * Calculates the maximum number of tiles a given number of knights can be placed on in the given direction from a specific point.
	 * @param origin grid x,y in which the castle tile was placed
	 * @param dir North, South, East, West
	 * @param knights number of knights you'd like to place
	 * @return 0 = error, max number of tiles (including origin) that knights can be legally placed on.
	 * @author Andrew Landphier
	 */
	public int getMaxTiles(Point origin, String dir, int knights ){
		int maxtiles = 0, knightsleft = knights, knightreq = 0, knightcur = 0;
		int curX = origin.getX(), curY = origin.getY();
		Point p = getItr(dir);
		int itrX = p.getX(), itrY = p.getY();
		
		//Base tile placing knights on (aka the castle tile)
		knightreq = getKnightRequirement(tilestate[curX][curY][TILE]);
		
		//check the current knight count at the tile for completeness sake (should be zero)
		knightcur = tilestate[curX][curY][KNIGHT];
		if (knightcur != 0) { 
			System.out.println("[ERROR] Tile just placed is not empty ?" + "Contains : " + knightcur + " tiles");
			return maxtiles;
		} else
			//subtract base knights required and increment max tiles
			knightsleft =- knightreq;
			maxtiles++;
			
			while (knightsleft > 0) {
				int nextX = curX+itrX, nextY = curY+itrY;
				
				// Check bounds on the array
				if ((nextX >= 0) && (nextX <= iBoardSize-1) && (nextY >= 0) && (nextY <= iBoardSize-1)) {
					knightreq = getKnightRequirement(tilestate[nextX][nextY][TILE]);
					knightcur = tilestate[nextX][nextY][KNIGHT];
					
					//If the tile is a valid tile
					if ( knightreq != 0) {
						//If their isn't already 5 knights
						if (knightcur < MAXknights) {
							
							//Assume that the knight requirements have been met and enforced
							if (knightcur != 0) {
								knightreq = 1;
								knightsleft =- knightreq;
							} else {
								knightsleft =- knightreq;
							}
							
							// Check if the tiles would result in a -1 knight pool
							if (knightsleft < 0) {
								System.out.println("Next tile would result in : " + knightsleft + " knights");
							} else {
								//Increment the max tiles
								maxtiles++;
							}	
						} else {
							//Patch is blocked cannot place more knights
							knightsleft = -1;
							System.out.println("There are already five knights on the tile");
						}
					} else {
						//Invalid tile (lake/invalid)
						knightsleft = -1;
						System.out.println("Tile ran into that cannot have tiles placed on it");
					}
					
				} else
					knightsleft = -1;
					System.out.println("Board out of bounds");
			}
			return maxtiles;
	}
	
	/**
	 * ----------> (NOT USED) <----------
	 * Get the minimum number of tiles required to cover at the given origin, heading in a given direction, for a specific amount of knights.
	 * Essentially removes knights as rapidly as it can until it can't remove anymore.
	 * @param origin grid x,y in which the castle tile was placed
	 * @param dir North, South, East, West
	 * @param knights number of knights you'd like to place
	 * @return 0 = error, min number of tiles (including origin) that knights can be legally placed on.
	 * @author Andrew Landphier
	 */
	public int getMinTiles(Point origin, String dir, int knights){
		int mintiles = 0, knightsleft = knights, knightreq = 0, knightcur = 0;
		int curX = origin.getX(), curY = origin.getY();
		Point p = getItr(dir);
		int itrX = p.getX(), itrY = p.getY();
		
		//Base tile placing knights on (aka the castle tile)
		knightreq = getKnightRequirement(tilestate[curX][curY][TILE]);
		
		//check the current knight count at the tile for completeness sake (should be zero)
		knightcur = tilestate[curX][curY][KNIGHT];
		if (knightcur != 0) { 
			System.out.println("[ERROR] Tile just placed is not empty ?" + "Contains : " + knightcur + " tiles");
			//can't place any
			return mintiles;
		
		} else
			//If we have 4 or more knights place them all
			if (knightsleft >= 4) {
				knightsleft =- 4;
				//can use two tiles if five
				mintiles++;
				
				//one left over
				if (knightsleft == 1) {
					int nextX = curX+itrX, nextY = curY+itrY;
					// Check bounds on the array
					if ((nextX >= 0) && (nextX <= iBoardSize-1) && (nextY >= 0) && (nextY <= iBoardSize-1)) {
						knightreq = getKnightRequirement(tilestate[nextX][nextY][TILE]);
						knightcur = tilestate[nextX][nextY][KNIGHT];
						
						//If the adjacent tile only requires 1 and contains less then 5 knights
						if (knightreq == 1 && knightcur < 5) {
							knightsleft =- 1;
							mintiles++;
						} 
					}
				}
			// else	place all the knights passed (will be above requirements and below max)
			} else if (knightsleft >= knightreq){
				knightsleft =- knightsleft;
				mintiles++;
			} else if (knightsleft < knightreq){
				//can't place any
				mintiles = 0;
			}
			
		return mintiles;
	}
	
	
	/**
	 * Gets the maximum number of knights that a user can place on the board.
	 * @param origin (point) at which the user is placing knights
	 * @param dir (String) direction in which the user plans on adding knights
	 * @param knightcount (int) current number of knights he has placed
	 * @return (int) max number of knights he can place on that tile
	 * @author Andrew Landphier
	 */
	public static int getMaxKnights(Point origin, String dir, int knightcount){
		
		int maxknights = 0, knightreq = 0, knightcur = 0, lock = 0;
		int curX = origin.getX(), curY = origin.getY();
		
		//Total knights available
		maxknights = 5 - knightcount;
		
		//If the player has less knights available then he's allowed to place
		if (maxknights  > Driver.getCurrentPlayer().getNumKnights()) {
			maxknights = Driver.getCurrentPlayer().getNumKnights();
		}
		
		//Iterative nature taken out because it is implemented through recursion in the knights popup
		//while (lock == 0) {
			if ((curX >= 0) && (curX <= iBoardSize-1) && (curY >= 0) && (curY <= iBoardSize-1)) {
				knightreq = getKnightRequirement(tilestate[curX][curY][TILE]);
				knightcur =  tilestate[curX][curY][KNIGHT];
				
				// Not enough knights | tile already has 5 knights | invalid tile
				System.out.println("MAXKNIGHTS:: " + maxknights);
				System.out.println("Knights required:: " + knightreq);
				System.out.println("Knights current:: " + knightcur);
				if (knightreq > maxknights || knightcur == MAXknights || knightreq == 0) {
					lock = 1;
					maxknights = 0;
				//Tile has knights on it covering requirements
				} else if (knightcur >= knightreq) {
					int openknights = (MAXknights-knightcur); //top off the
					if (openknights <= maxknights) {
						maxknights = openknights;
					} else {
						//max knights is itself
					}
				} else {
					System.out.println("got to final else");
					//Can't place anymore
					
					 if (maxknights == 5) {
						System.out.println("got to max = 5");
						maxknights = 4;
						lock = 1;
					} else if (maxknights+knightcur > MAXknights) {	
						lock = 1;
					//Can't place more then 5 at a tile
					}
				}
			//curX = curX+itrX;
			//curY = curY+itrY;
		//	}
		}
		return maxknights;
	}
	
	/**
	 * Returns the minimum number of knights required to place on the current tile at the location
	 * @param origin
	 * @param knightcount
	 * @param p
	 * @return
	 */
	public static int getMinKnights(Point origin, int knightcount, Player p) {
		int current = 5-knightcount;
		int curX = origin.getX();
		int curY = origin.getY();
		int minKnights = getKnightRequirement(tilestate[curX][curY][TILE]);
		
		if (current == 0) {return 0;}
		int knightreq = getKnightRequirement(tilestate[curX][curY][TILE]);
		int playercur = tilestate[curX][curY][PLAYER];
	
		if (p.getPlayerNum() == playercur) {
			minKnights = 1;
		} else 
			minKnights = knightreq;
		
		
		
		return minKnights;
		
	}
	
	
	/**
	 * Takes in the integer representation of the tile and returns the required amount of knights
	 * @param tile integer representation of the tile
	 * @return int knights required
	 * @author Andrew Landphier
	 */
	public static int getKnightRequirement(int tile){
		int req = 0;
		if (tile == 1 || tile == 2 || tile == 3 || tile == 4) {
			req = 1;
		} else if (tile == 5 || tile == 6 || tile == 7) {
			req = 2;
		} else if (tile == 8) {
			req = 3;
		}
		return req;
	}
	
	/**
	 * Gets the integer value of the tile for the Board State Array update
	 * @param t tile you are looking to get the int for
	 * @return 0 = blank, 1 = plain, 2 = plain_castle, 3 = plain_town, 4 = plain_village(1), 5 = forest_castle, 6 = forest_town, 7 =forest_village(2), 8 = mountain(3), 9= lake(n/a)
	 * @author Andrew Landphier
	 */
	public static int getTileInt(Tile t ){
		int tile = 0;
		String tland = t.tland;
		String tbuilding = t.tbuilding;
		
		if (tland == Driver.PLAIN) {
			if (tbuilding == Driver.VILLAGE){
				tile = 4;
			}
			if (tbuilding == Driver.TOWN) {
				tile = 3;
			}			
			if (tbuilding == Driver.CASTLE) {
				tile = 2;
			}
			if (tbuilding == Driver.NONE) {
				tile = 1;
			}
		} else if (tland == Driver.FOREST){
			if (tbuilding == Driver.VILLAGE) {
				tile = 7;
			}
			if (tbuilding == Driver.TOWN) {
				tile = 6;
			}
			if (tbuilding == Driver.CASTLE) {
				tile = 5;
			}
		} else if (tland == Driver.MOUNTAIN){
			tile = 8;
		} else if (tland == Driver.LAKE) {
			tile = 9;
		}
		
		return tile;
	}

	// **************** Setters ************************************
	
	/**
	 * Matches the passed in panel with the Board of panels and finds its x,y board location.
	 * Invoked from a successful popupmenu tile placement.
	 * @param panel source JPanel 
	 * @param t tile placed on the board
	 * @author Andrew Landphier
	 */
	public static Point matchTile(JPanel panel) {
		Point p = new Point();
		for (int i = 0; i < iBoardSize; i++ ){
			for (int j = 0; j < iBoardSize; j++){
				if (panel.equals(Board.grid[i][j])) {
					p.setX(i);
					p.setY(j); //setTile(new Point(i,j), getTileInt(land, building));
					
				}
			}
		} return p;
	}
	
	
	public static void setMax(Point p, int maxset){
		tilestate[p.getX()][p.getY()][MAX] = maxset;
	}
	
	/**
	 * Sets the value of the third item of the table element array at the given point on the board
	 * @param p board x,y coordinate
	 * @param iType 0 = blank, 1 = plain, 2 = plain_castle, 3 = plain_town, 4 = plain_village, 5 = forest_castle, 6 = forest_town, 7 =forest_village, 8 = mountain, 9= lake
	 * @author Andrew Landphier
	 */
	public static void setTile(Point p, int iType) {

		if (iType < 10){
			tilestate[p.getX()][p.getY()][TILE] = iType;
			System.out.println("Set tile at [" + p.getX() + "][" + p.getY() + "] with " + iType);
		} else ;
	}

	/**
	 * Sets the value of the knights at the designated point location
	 * @param p board x.y coordinate
	 * @param iKnights number of knights being placed on the board
	 * @author Andrew Landphier
	 */
	public static void setKnight(Point p, int iKnights) {
		if (tilestate[p.getX()][p.getY()][TILE] != 0){
			if (iKnights < (MAXknights+1)) {
				tilestate[p.getX()][p.getY()][KNIGHT] = iKnights;
				System.out.println("Set knights at [" + p.getX() + "][" + p.getY() + "] with " + iKnights);
			} else;
		} else;
	}
		
	/**
	 * Sets the player who owns the tile or the top knight on the tile
	 * @param p board x,y cooridinate
	 * @param iPlayer 0 = blank, player 1 = 1, player 2 = 2, etc
	 * @author Andrew Landphier
	 */
	public static void setPlayer(Point p, int iPlayer) {
		if (tilestate[p.getX()][p.getY()][TILE] != 0) {
			if (iPlayer < 5) {
				tilestate[p.getX()][p.getY()][PLAYER] = iPlayer;
				System.out.println("Set player at [" + p.getX() + "][" + p.getY() + "] with " + iPlayer);
			} else ;
		} else;
	
		}
	
	/**
	 * Adds knights to the current knight count held by the tilestate
	 * @param p point to add knights
	 * @param iKnighti int number of knights to add
	 *  @author Andrew Landphier
	 */
	public static void addKnight(Point p, int iKnight) {
		int total = (tilestate[p.getX()][p.getY()][KNIGHT] + iKnight);
		if (total > MAXknights) {
			System.out.println("Error while adding knights. Total Exceeds 5 : " + total);
		}
		System.out.println("Setting knight value at [" + p.getX() + "][" + p.getY() + "] with : " + total);
		tilestate[p.getX()][p.getY()][KNIGHT] = total;
	}
	
	
	/*********************************************************************/
	/**
	 * Get tile from the Array of tiles on the board
	 * @param int 
	 * 
	 * @author Jeff Xiong
	 */
	public static Tile getTile(int i) {
		
		return tilesOnBoard.get(i);
		
		
		}
	/**
	 * Finds equal tile from the Array of tiles on the board
	 * @param point 
	 * 
	 * @author Jeff Xiong
	 */
	public static Tile findTile(Point p) {
		
		
		for(Tile x:tilesOnBoard)
		{
			if(x.getPoint().equals(p))return x;
		}
		
		return null;
		
		
		}
	/**
	 * Add tile to the Array of tiles on the board
	 * @param Tile
	 * 
	 * @author Jeff Xiong
	 */
	public static void setTile(Tile t) {
		
		ArrayList<Tile> tilesOnBoard2=new ArrayList<Tile>();
		for(int i=0;i<tilesOnBoard.size();++i)
		{
			
			if(tilesOnBoard.get(i).getPoint().equals(t.getPoint())){
				//tilesOnBoard[i]=t;
				tilesOnBoard2.add(t);
				
			}
			else
			{
				tilesOnBoard2.add(tilesOnBoard.get(i));
			}
		}
		
		tilesOnBoard=tilesOnBoard2;
		}
	
	/**
	 * Add tile to the Array of tiles on the board
	 * @param Tile
	 * 
	 * @author Jeff Xiong
	 */
	public static void addTile(Tile t) {
		
		tilesOnBoard.add(t);
		
		
		}
	
	
	/*****************************Get Source JPanels DELETE****************************************/
	 
	/**
	 * Get  Source JPanels from the Array of Source JPanels on the board
	 * @param int 
	 * 
	 * @author Jeff Xiong
	 */
	public static JPanel getPanel(int i) {
		
		return srcPanel.get(i);
		
		
		}
	@Deprecated 
	/**
	 * Finds equal  Source JPanels from the Array of  Source JPanels on the board
	 * @param point 
	 * 
	 * @author Jeff Xiong
	 */
	public static JPanel findPanel(Point p) {
		
		System.out.println("  ");
		System.out.println("  ");
		System.out.println(" findpanel ");
		System.out.println(p.getX()+","+p.getY());
		for(JPanel x:srcPanel)
		{
			
			Point T=new Point(x.getX(),x.getY());
			if(T.equals(p))return x;
			System.out.println(x.getX()+","+x.getY());
		}
		
		
		System.out.println(srcPanel.size());
		System.out.println("NULLLLLLLLLLLLLLL");
		return null;
		
		
		}
	
	@Deprecated 
	/**
	 * Add Source JPanels to the Array of  Source JPanels on the board
	 * @param Tile
	 * 
	 * @author Jeff Xiong
	 */
	public static void setPanel(JPanel t) {
		Point tT=new Point(t.getX(),t.getY());
		
		
		ArrayList<JPanel> srcPanel2=new ArrayList<JPanel>();
		for(int i=0;i<srcPanel.size();++i)
		{
			Point T=new Point(srcPanel.get(i).getX(),srcPanel.get(i).getY());
			if(tT.equals(T)){
				//tilesOnBoard[i]=t;
				srcPanel2.add(t);
				
			}
			else
			{
				srcPanel2.add(srcPanel.get(i));
			}
		}
		
		srcPanel=srcPanel2;
		}
	@Deprecated 
	/**
	 * Add tile to the Array of  Source JPanels on the board
	 * @param Tile
	 * 
	 * @author Jeff Xiong
	 */
	public static void addPanel(JPanel t) {
		
		srcPanel.add(t);
		
		
		}
	
	
	// ***************************** Validation ******************************

	public static boolean isMax(Point p, Player player, int iknights){
		boolean tryingtoplacemorethenfive = false;
		if (tilestate[p.getX()][p.getY()][PLAYER] == player.getPlayerNum()) {
			if ((tilestate[p.getX()][p.getY()][MAX] + iknights) > 4) {
				tryingtoplacemorethenfive = true;
			}	
		}
		return tryingtoplacemorethenfive;
	}
	/**
	 * Checks whether the tile is full of knights
	 * @param p (point) to check
	 */
	public static boolean isMaxKnights(Point p){
		boolean max = false;
		if (getKnight(p)== MAXknights){
			max = true;
		}
		return max;
	}
	
	/**
	 * Checks whether the tile is a valid tile to place knights on
	 * @param p (point) to check
	 * @return boolean if it is a valid tile
	 *  @author Andrew Landphier
	 */
	public static boolean checkValidTile(Point p){
		boolean check = false;
		if (!(p.getX() < 0) && !(p.getX() > iBoardSize-1) && !(p.getY() < 0) && !(p.getY() > iBoardSize-1)){
			if (getTile(new Point(p.getX(), p.getY())) != 0 && getTile(new Point(p.getX(), p.getY())) != 9) {
				if (getKnight(new Point(p.getX(), p.getY())) < MAXknights){
					check = true;
				}
			}
		}
		return check;
	}
	
	/**
	 * Checks the current state of the board to see if the initial board is filled.
	 * @param player int number of players
	 * @return boolean true if the initial board is full
	 * @author Andrew Landphier
	 */
	public static boolean checkInitialBoardState(int player){
		boolean check = false;
		int count = 0;
		
		for (int i = 0; i < iBoardSize; i++ ){
			for (int j = 0; j < iBoardSize; j++){
				if (player == TWOPLAYERS && checkTwoPlayerBoard(i,j)) {
					if (tilestate[i][j][TILE] != 0){
						count++;
						if (count == 4){
							check = true;
						}
					}
				} else if (player == THREEPLAYERS && checkThreePlayerBoard(i,j)){
					if (tilestate[i][j][TILE] != 0) {
						count++;
						if (count == 6) {
							check = true;
						}
					}
				} else if (player == FOURPLAYERS && checkFourPlayerBoard(i,j)){
					if (tilestate[i][j][TILE] != 0) {
						count++;
						if (count == 8) {
							check = true;
						}
					}
				}
			}
		}
		return check;
	}
	
	/**
	 * Checks if the x,y coordinate is with the bounds of the board for the amount of players
	 * @param player int number of players
	 * @param x int coordinate of the board
	 * @param y int coordinate of the board
	 * @return true if the x,y coord are within the bounds of the board
	 * @author Andrew Landphier
	 */
	public static boolean checkBoard(int player, int x, int y) {
		boolean check = false;
		
		if (player == 2) {
			if (checkTwoPlayerBoard(x,y)) {
				check = true;
			}
		} else if (player == 3) {
			if (checkThreePlayerBoard(x,y)) {
				check = true;
			}
		} else if (player == 4) {
			if (checkFourPlayerBoard(x,y)) {
				check = true;
			}
		} 
		return check;
	}
	
	/**
	 * Checks if the x,y coordinates are within the two player initial setup boundaries
	 * @param x coordinate of the board
	 * @param y coordinate of the board
	 * @return true if the x,y coord are within the bounds of the board
	 */
	public static boolean checkTwoPlayerBoard(int x, int y) {
		boolean check = false;
		if (x > 2 && x < 5 && y > 2 && y < 5) {
			check = true;
		}
		return check;
	}
	
	/**
	 * Checks if the x,y coordinates are within the three player initial setup boundaries
	 * @param x coordinate of the board
	 * @param y coordinate of the board
	 * @return true if the x,y coord are within the bounds of the board
	 * @author Andrew Landphier
	 */
	public static boolean checkThreePlayerBoard(int x, int y) {
		boolean check = false;
		if (x > 2 && x < 5 && y > 2 && y < 6) {
			check = true;
		}
		return check;
	}
	
	/**
	 * Checks if the x,y coordinates are within the four player initial setup boundaries
	 * @param x coordinate of the board
	 * @param y coordinate of the board
	 * @return true if the x,y coord are within the bounds of the board
	 * @author Andrew Landphier
	 */
	public static boolean checkFourPlayerBoard(int x, int y) {
		boolean check = false;
		if (x > 3 && x < 6 && y > 2 && y < 7) {
			check = true;
		}
		return check;
	}
	
}